package com.shuhua.taskServer.controller;

import com.shuhua.common.result.Result;
import com.shuhua.pojo.dto.AdminProfileUpdateDTO;
import com.shuhua.pojo.vo.AdminProfileVO;
import com.shuhua.taskServer.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/admin")
public class AdminController {

    @Autowired
    private AdminService adminService;

    @GetMapping("/info")
    public Result<AdminProfileVO> getProfile() {
        AdminProfileVO profile = adminService.getAdminProfile();
        return Result.success(profile);
    }

    @PutMapping("/update")
    public Result<?> updateProfile(@RequestBody @Validated AdminProfileUpdateDTO updateDTO) {
        adminService.updateAdminProfile(updateDTO);
        return Result.success(null);
    }
}